<?php
$id = $_GET["id"];
$sqlStream = " SELECT post_id, app_id,updated_time, attribution, actor_id,target_id, message, likes, permalink FROM stream WHERE source_id= $id limit 3";
$sqlPage = "SELECT name, pic_small, pic_big, pic_square, pic, pic_large, page_url, type, website, has_added_app, founded, company_overview, mission, products, location, parking, public_transit, hours  FROM page WHERE page_id = $id";
$facebook = MyFacebook::getInstance();
$uid = $facebook->getUser();
echo "<h1>Il mio uid: $uid</h1>";
$arrayCall = array(
"method" => "fql.multiquery",
"queries" => array("stream" => $sqlStream,"pagine" => $sqlPage)
);
try {
  $query = $facebook->api($arrayCall);
  if ($query) {
    
    echo "<code>";
    echo "<pre>".print_r($query, true)."</pre>";
    echo "</code>";
  } else {
    echo "<p>Query non eseguita</p>";
  }
} catch (FacebookApiException $e) {
  echo "ERRORE: ".$e;
}
?>
<p>Documentazione Tabelle utilizzate:
<ul>
<li><a target="_blank" href="http://developers.facebook.com/docs/reference/fql/stream">Tabella Stream</a></li>
</ul>
</p>
<?php
$connections = array("feed", "picture", "tagged", "links", "photos", "groups", "albums", "statuses", "videos", "notes", "posts", "events");
$graphUrl="https://graph.facebook.com/".$id."/";
$myCookie = MyFacebook::get_facebook_cookie();
$myToken = $myCookie["access_token"];
foreach ($connections as $conn) {
  echo "<h2>".$conn."</h2>";
  $url =$graphUrl.$conn."?access_token=".$myToken;
  echo "<h3>".$url."</h3>";
  
  $connValue = json_decode(file_get_contents($url), true);
  echo "<pre>";
  print_r($connValue);
  echo "</pre>";
}

?>